package com.jsu.clubmanagementsystem.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 获取当前项目路径
        String projectPath = System.getProperty("user.dir");

        // 拼接出 photo 文件夹的路径
        String uploadPath = "file:" + projectPath + "/photo/";

        registry.addResourceHandler("/photo/**")
                .addResourceLocations(uploadPath);
    }
}

